
// 导入vue-router包
import VueRouter from 'vue-router'
// 导入中间router-view展示的组件
import home from './main/home.vue'
import search from './main/search.vue'
import shopcar from './main/shopcar.vue'
import menber from './main/menber.vue'
import newslist from './news/newslist.vue'
import newsinfo from './news/NewsInfo.vue'
import PhotoList from './photos/PhotoList.vue'
import photoInfo from './photos/photoInfo.vue'
import GoodsList from './goods/GoodsList.vue'
import GoodsInfo from './goods/GoodsInfo.vue'
import Goodsdesc from './goods/Goodsdesc.vue'
// 创建路由对象
var router = new VueRouter({
	routes:[//配置路由规则
		{ path:'/home',component:home},
		{ path:'/search',component:search},
		{ path:'/shopcar',component:shopcar},
		{ path:'/menber',component:menber},
		{ path:'/', redirect:'/home'},
		{ path:'/home/newslist', component: newslist},
		{ path:'/home/newsInfo/:id',component: newsinfo},
		{ path:'/home/PhotoList/:id',component: PhotoList},
		{ path:'/home/photoInfo/:id',component: photoInfo},
		{ path:'/home/goodslist',component: GoodsList},
		{ path:'/home/goodsinfo/:id',component: GoodsInfo, name:"goodsinfo" },
		{ path:'/home/goodsdesc/:id',component: Goodsdesc, name:"Goods" },

	],
	linkActiveClass:' mui-active' //覆盖默认的路由高亮的类 router-link-active
});
router.afterEach((to,from,next) => {
	window.scrollTo(0,0);
	// 或
	// window.scroll(0, 0);
  });
export default router